/*     */ package com.jcrj.action.message;
/*     */ 
/*     */ import com.jcrj.action.BaseAction;
/*     */ import com.jcrj.entity.ODraftMessages;
/*     */ import com.jcrj.entity.OMessageMajor;
/*     */ import com.jcrj.entity.OMessageSet;
/*     */ import com.jcrj.entity.OMessagesReceiver;
/*     */ import com.jcrj.entity.OTextmessages;
/*     */ import com.jcrj.entity.OUser;
/*     */ import com.jcrj.service.MessageService;
/*     */ import java.io.IOException;
/*     */ import java.io.PrintWriter;
/*     */ import java.util.Date;
/*     */ import java.util.List;
/*     */ import java.util.Map;
/*     */ import javax.servlet.http.HttpServletResponse;
/*     */ 
/*     */ public class MessageAction extends BaseAction
/*     */ {
/*     */   private MessageService messageService;
/*     */   private OTextmessages message;
/*     */   private OMessagesReceiver messageReceiver;
/*     */   private ODraftMessages draftMessage;
/*     */   private List<OTextmessages> messages;
/*     */   private List<ODraftMessages> draftMessages;
/*     */   private List<OMessagesReceiver> messageReceivers;
/*     */   private long pageCount;
/*     */   private long totalCount;
/*     */   private String[] ids;
/*     */   private String content;
/*     */   private String messageId;
/*     */   private String info;
/*     */   private OMessageSet messageSet;
/*     */   private OMessageMajor messageMajor;
/*     */   private List<OMessageSet> messageSets;
/*     */   private List<OMessageMajor> messageMajors;
/*     */   private int userId;
/*     */ 
/*     */   public MessageService getMessageService()
/*     */   {
/*  21 */     return this.messageService;
/*     */   }
/*     */   public void setMessageService(MessageService messageService) {
/*  24 */     this.messageService = messageService;
/*     */   }
/*     */ 
/*     */   public int getUserId()
/*     */   {
/*  46 */     return this.userId;
/*     */   }
/*     */   public void setUserId(int userId) {
/*  49 */     this.userId = userId;
/*     */   }
/*     */   public OMessageSet getMessageSet() {
/*  52 */     return this.messageSet;
/*     */   }
/*     */   public void setMessageSet(OMessageSet messageSet) {
/*  55 */     this.messageSet = messageSet;
/*     */   }
/*     */   public OMessageMajor getMessageMajor() {
/*  58 */     return this.messageMajor;
/*     */   }
/*     */   public void setMessageMajor(OMessageMajor messageMajor) {
/*  61 */     this.messageMajor = messageMajor;
/*     */   }
/*     */   public List<OMessageSet> getMessageSets() {
/*  64 */     return this.messageSets;
/*     */   }
/*     */   public void setMessageSets(List<OMessageSet> messageSets) {
/*  67 */     this.messageSets = messageSets;
/*     */   }
/*     */   public List<OMessageMajor> getMessageMajors() {
/*  70 */     return this.messageMajors;
/*     */   }
/*     */   public void setMessageMajors(List<OMessageMajor> messageMajors) {
/*  73 */     this.messageMajors = messageMajors;
/*     */   }
/*     */   public String getInfo() {
/*  76 */     return this.info;
/*     */   }
/*     */   public void setInfo(String info) {
/*  79 */     this.info = info;
/*     */   }
/*     */   public String getMessageId() {
/*  82 */     return this.messageId;
/*     */   }
/*     */   public void setMessageId(String messageId) {
/*  85 */     this.messageId = messageId;
/*     */   }
/*     */   public String getContent() {
/*  88 */     return this.content;
/*     */   }
/*     */   public void setContent(String content) {
/*  91 */     this.content = content;
/*     */   }
/*     */   public long getPageCount() {
/*  94 */     return this.pageCount;
/*     */   }
/*     */   public void setPageCount(long pageCount) {
/*  97 */     this.pageCount = pageCount;
/*     */   }
/*     */   public long getTotalCount() {
/* 100 */     return this.totalCount;
/*     */   }
/*     */   public void setTotalCount(long totalCount) {
/* 103 */     this.totalCount = totalCount;
/*     */   }
/*     */   public String[] getIds() {
/* 106 */     return this.ids;
/*     */   }
/*     */   public void setIds(String[] ids) {
/* 109 */     this.ids = ids;
/*     */   }
/*     */   public List<OMessagesReceiver> getMessageReceivers() {
/* 112 */     return this.messageReceivers;
/*     */   }
/*     */   public void setMessageReceivers(List<OMessagesReceiver> messageReceivers) {
/* 115 */     this.messageReceivers = messageReceivers;
/*     */   }
/*     */   public List<OTextmessages> getMessages() {
/* 118 */     return this.messages;
/*     */   }
/*     */   public void setMessages(List<OTextmessages> messages) {
/* 121 */     this.messages = messages;
/*     */   }
/*     */   public List<ODraftMessages> getDraftMessages() {
/* 124 */     return this.draftMessages;
/*     */   }
/*     */   public void setDraftMessages(List<ODraftMessages> draftMessages) {
/* 127 */     this.draftMessages = draftMessages;
/*     */   }
/*     */   public OTextmessages getMessage() {
/* 130 */     return this.message;
/*     */   }
/*     */   public void setMessage(OTextmessages message) {
/* 133 */     this.message = message;
/*     */   }
/*     */   public OMessagesReceiver getMessageReceiver() {
/* 136 */     return this.messageReceiver;
/*     */   }
/*     */   public void setMessageReceiver(OMessagesReceiver messageReceiver) {
/* 139 */     this.messageReceiver = messageReceiver;
/*     */   }
/*     */   public ODraftMessages getDraftMessage() {
/* 142 */     return this.draftMessage;
/*     */   }
/*     */   public void setDraftMessage(ODraftMessages draftMessage) {
/* 145 */     this.draftMessage = draftMessage;
/*     */   }
/*     */   public String message() {
/* 148 */     OUser user = this.messageService.getUserById(this.userId);
/* 149 */     this.draftMessage = new ODraftMessages();
/* 150 */     this.draftMessage.setReceiverIds(user.getId().toString());
/* 151 */     if ((!"".equals(user.getPhone())) && (user.getPhone() != null)) {
/* 152 */       this.draftMessage.setReceiverNames(user.getName() + "(" + user.getPhone() + ")");
/*     */     }
/*     */     else {
/* 155 */       this.draftMessage.setReceiverNames(user.getName());
/*     */     }
/* 157 */     return "success";
/*     */   }
/*     */ 
/*     */   public String writeMessage() {
/* 161 */     return "success";
/*     */   }
/*     */   public String sendMessage() {
/*     */     try {
/* 165 */       OUser user = (OUser)super.getSession().get("userInfo");
/* 166 */       this.draftMessage.setSendId(user.getId());
/* 167 */       this.draftMessage.setSendName(user.getName());
/* 168 */       this.draftMessage.setModulename("jcrj");
/* 169 */       this.draftMessage.setExnumber("1");
/* 170 */       this.draftMessage.setMessageflag("1");
/* 171 */       this.draftMessage.setPriority("1");
/* 172 */       this.draftMessage.setCreateTime(new Date());
/* 173 */       this.info = this.messageService.saveMessage(this.draftMessage);
/*     */     } catch (Exception e) {
/* 175 */       e.printStackTrace();
/*     */     }
/* 177 */     return "success";
/*     */   }
/*     */   public String draftMessage() {
/*     */     try {
/* 181 */       OUser user = (OUser)super.getSession().get("userInfo");
/* 182 */       this.draftMessage.setSendId(user.getId());
/* 183 */       this.draftMessage.setSendName(user.getName());
/* 184 */       this.draftMessage.setModulename("jcrj");
/* 185 */       this.draftMessage.setExnumber("1");
/* 186 */       this.draftMessage.setMessageflag("1");
/* 187 */       this.draftMessage.setPriority("1");
/* 188 */       this.draftMessage.setCreateTime(new Date());
/* 189 */       this.messageService.saveDraftMessage(this.draftMessage);
/*     */     } catch (Exception e) {
/* 191 */       e.printStackTrace();
/*     */     }
/* 193 */     return "success";
/*     */   }
/*     */ 
/*     */   public String receivedMessages()
/*     */   {
/* 201 */     OUser user = (OUser)super.getSession().get("userInfo");
/* 202 */     this.totalCount = this.messageService.receivedMessagesCount(user, this.content, super.getStartDate(), super.getEndDate(), super.getCurrentPage());
/* 203 */     this.pageCount = ((this.totalCount - 1L) / 10L + 1L);
/* 204 */     if (super.getCurrentPage() > this.pageCount) {
/* 205 */       super.setCurrentPage(Long.valueOf(this.pageCount).intValue());
/*     */     }
/* 207 */     this.messageReceivers = this.messageService.receivedMessages(user, this.content, super.getStartDate(), super.getEndDate(), super.getCurrentPage());
/* 208 */     return "success";
/*     */   }
/*     */   public String updateMessage() {
/*     */     try {
/* 212 */       OUser user = (OUser)super.getSession().get("userInfo");
/* 213 */       this.messageService.updateMessage(this.ids, user);
/* 214 */       super.getResponse().getWriter().write("success");
/* 215 */       super.getResponse().getWriter().flush();
/*     */     } catch (Exception e) {
/* 217 */       e.printStackTrace();
/*     */       try
/*     */       {
/* 220 */         super.getResponse().getWriter().close();
/*     */       } catch (IOException e1) {
/* 222 */         e1.printStackTrace();
/*     */       }
/*     */     }
/*     */     finally
/*     */     {
/*     */       try
/*     */       {
/* 220 */         super.getResponse().getWriter().close();
/*     */       } catch (IOException e) {
/* 222 */         e.printStackTrace();
/*     */       }
/*     */     }
/* 225 */     return null;
/*     */   }
/*     */ 
/*     */   public String draftMessages()
/*     */   {
/* 236 */     OUser user = (OUser)super.getSession().get("userInfo");
/* 237 */     this.totalCount = this.messageService.draftMessagesCount(user, this.content, super.getStartDate(), super.getEndDate(), super.getCurrentPage());
/* 238 */     this.pageCount = ((this.totalCount - 1L) / 10L + 1L);
/* 239 */     if (super.getCurrentPage() > this.pageCount) {
/* 240 */       super.setCurrentPage(Long.valueOf(this.pageCount).intValue());
/*     */     }
/* 242 */     this.draftMessages = this.messageService.draftMessages(user, this.content, super.getStartDate(), super.getEndDate(), super.getCurrentPage());
/* 243 */     return "success";
/*     */   }
/*     */ 
/*     */   public String getDraftMessageById() {
/* 247 */     this.draftMessage = this.messageService.getDraftMessage(this.messageId);
/* 248 */     return "success";
/*     */   }
/*     */   public String sendDraftMessageById() {
/* 251 */     this.draftMessage.setCreateTime(new Date());
/* 252 */     this.info = this.messageService.saveMessage(this.draftMessage);
/* 253 */     return "success";
/*     */   }
/*     */   public String updateDraftMessageById() {
/* 256 */     this.draftMessage.setCreateTime(new Date());
/* 257 */     this.messageService.saveDraftMessage(this.draftMessage);
/* 258 */     return "success";
/*     */   }
/*     */   public String deleteDraftMessage() {
/*     */     try {
/* 262 */       OUser user = (OUser)super.getSession().get("userInfo");
/* 263 */       this.messageService.deleteDraftMessage(this.ids, user);
/* 264 */       super.getResponse().getWriter().write("success");
/* 265 */       super.getResponse().getWriter().flush();
/*     */     } catch (Exception e) {
/* 267 */       e.printStackTrace();
/*     */       try
/*     */       {
/* 270 */         super.getResponse().getWriter().close();
/*     */       } catch (IOException e1) {
/* 272 */         e1.printStackTrace();
/*     */       }
/*     */     }
/*     */     finally
/*     */     {
/*     */       try
/*     */       {
/* 270 */         super.getResponse().getWriter().close();
/*     */       } catch (IOException e) {
/* 272 */         e.printStackTrace();
/*     */       }
/*     */     }
/* 275 */     return null;
/*     */   }
/*     */ 
/*     */   public String sendedMessages()
/*     */   {
/* 288 */     OUser user = (OUser)super.getSession().get("userInfo");
/* 289 */     this.totalCount = this.messageService.sendedMessagesCount(user, this.content, super.getStartDate(), super.getEndDate(), super.getCurrentPage());
/* 290 */     this.pageCount = ((this.totalCount - 1L) / 10L + 1L);
/* 291 */     if (super.getCurrentPage() > this.pageCount) {
/* 292 */       super.setCurrentPage(Long.valueOf(this.pageCount).intValue());
/*     */     }
/* 294 */     this.messages = this.messageService.sendeddMessages(user, this.content, super.getStartDate(), super.getEndDate(), super.getCurrentPage());
/* 295 */     return "success";
/*     */   }
/*     */   public String updateSendedMessage() {
/*     */     try {
/* 299 */       OUser user = (OUser)super.getSession().get("userInfo");
/* 300 */       this.messageService.updateSendedMessage(this.ids, user);
/* 301 */       super.getResponse().getWriter().write("success");
/* 302 */       super.getResponse().getWriter().flush();
/*     */     } catch (Exception e) {
/* 304 */       e.printStackTrace();
/*     */       try
/*     */       {
/* 307 */         super.getResponse().getWriter().close();
/*     */       } catch (IOException e1) {
/* 309 */         e1.printStackTrace();
/*     */       }
/*     */     }
/*     */     finally
/*     */     {
/*     */       try
/*     */       {
/* 307 */         super.getResponse().getWriter().close();
/*     */       } catch (IOException e) {
/* 309 */         e.printStackTrace();
/*     */       }
/*     */     }
/* 312 */     return null;
/*     */   }
/*     */ 
/*     */   public String deletedMessages()
/*     */   {
/* 322 */     OUser user = (OUser)super.getSession().get("userInfo");
/* 323 */     this.totalCount = this.messageService.deletedMessagesCount(user, this.content, super.getStartDate(), super.getEndDate(), super.getCurrentPage());
/* 324 */     this.pageCount = ((this.totalCount - 1L) / 10L + 1L);
/* 325 */     if (super.getCurrentPage() > this.pageCount) {
/* 326 */       super.setCurrentPage(Long.valueOf(this.pageCount).intValue());
/*     */     }
/* 328 */     this.messageReceivers = this.messageService.deletedMessages(user, this.content, super.getStartDate(), super.getEndDate(), super.getCurrentPage());
/* 329 */     return "success";
/*     */   }
/*     */   public String deleteMessage() {
/*     */     try {
/* 333 */       OUser user = (OUser)super.getSession().get("userInfo");
/* 334 */       this.messageService.deleteMessage(this.ids, user);
/* 335 */       super.getResponse().getWriter().write("success");
/* 336 */       super.getResponse().getWriter().flush();
/*     */     } catch (Exception e) {
/* 338 */       e.printStackTrace();
/*     */       try
/*     */       {
/* 341 */         super.getResponse().getWriter().close();
/*     */       } catch (IOException e1) {
/* 343 */         e1.printStackTrace();
/*     */       }
/*     */     }
/*     */     finally
/*     */     {
/*     */       try
/*     */       {
/* 341 */         super.getResponse().getWriter().close();
/*     */       } catch (IOException e) {
/* 343 */         e.printStackTrace();
/*     */       }
/*     */     }
/* 346 */     return null;
/*     */   }
/*     */ 
/*     */   public String messageSet()
/*     */   {
/* 360 */     this.totalCount = this.messageService.messageSetCount(super.getCurrentPage());
/* 361 */     this.pageCount = ((this.totalCount - 1L) / 10L + 1L);
/* 362 */     if (super.getCurrentPage() > this.pageCount) {
/* 363 */       super.setCurrentPage(Long.valueOf(this.pageCount).intValue());
/*     */     }
/* 365 */     this.messageSets = this.messageService.messageSet(super.getCurrentPage());
/* 366 */     return "success";
/*     */   }
/*     */   public String messageSetAdd() {
/* 369 */     return "success";
/*     */   }
/*     */ 
/*     */   public String messageSetAddSave() {
/* 373 */     OUser user = (OUser)getSession().get("userInfo");
/* 374 */     if ("a".equals(super.getStatus())) {
/* 375 */       this.messageSet.setCreateTime(new Date());
/* 376 */       this.messageSet.setDel("0");
/* 377 */       this.messageSet.setUserId(user.getId());
/* 378 */       this.messageSet.setUserName(user.getName());
/* 379 */       this.info = this.messageService.saveMessageSet(this.messageSet, super.getStatus());
/*     */     }
/* 381 */     if ("u".equals(super.getStatus())) {
/* 382 */       this.messageSet.setCreateTime(new Date());
/* 383 */       this.messageSet.setUserId(user.getId());
/* 384 */       this.messageSet.setUserName(user.getName());
/* 385 */       this.info = this.messageService.saveMessageSet(this.messageSet, super.getStatus());
/*     */     }
/* 387 */     return "success";
/*     */   }
/*     */   public String messageSetUpdate() {
/* 390 */     this.messageSet = this.messageService.getMessageSet(this.messageSet);
/* 391 */     return "success";
/*     */   }
/*     */   public String messageSetDelete() {
/*     */     try {
/* 395 */       this.messageService.deleteMessageSet(this.ids);
/* 396 */       super.getResponse().getWriter().write("success");
/* 397 */       super.getResponse().getWriter().flush();
/*     */     } catch (Exception e) {
/* 399 */       e.printStackTrace();
/*     */       try
/*     */       {
/* 402 */         super.getResponse().getWriter().close();
/*     */       } catch (IOException e1) {
/* 404 */         e1.printStackTrace();
/*     */       }
/*     */     }
/*     */     finally
/*     */     {
/*     */       try
/*     */       {
/* 402 */         super.getResponse().getWriter().close();
/*     */       } catch (IOException e) {
/* 404 */         e.printStackTrace();
/*     */       }
/*     */     }
/* 407 */     return null;
/*     */   }
/*     */ }

/* Location:           /Volumes/work/oa/WEB-INF/classes/
 * Qualified Name:     com.jcrj.action.message.MessageAction
 * JD-Core Version:    0.6.0
 */